// Author: wsfuyibing <682805@qq.com>
// Date: 2025-06-11

package responses

import (
	"gitee.com/go-libs/db-xorm/db"
	"server/app/http/models"
	"server/app/kind"
)

// BalanceRecordResponse
// 订单信息.
type BalanceRecordResponse struct {
	Id                int64
	UserId            kind.UserId
	Balance           kind.Balance
	Before            kind.Balance
	Operate           kind.Balance
	OperateType       kind.BalanceOperate
	OperateTypeText   string
	OperateIncome     kind.BalanceIncome
	OperateIncomeText string
	Link              kind.Link
	LinkUrl           string
	LinkParams        kind.LinkParams
	CreatedAt         db.Datetime
}

// With
// 数据绑定.
func (o *BalanceRecordResponse) With(m *models.BalanceRecords) *BalanceRecordResponse {
	o.Id = m.Id
	o.UserId = m.UserId
	o.Balance = m.Balance
	o.Before = m.Before
	o.Operate = m.Operate
	o.OperateType = m.OperateType
	o.OperateTypeText = o.OperateType.Text()
	o.OperateIncome = m.OperateIncome
	o.OperateIncomeText = m.OperateIncome.Text()
	o.Link = m.Link
	o.LinkUrl = m.Link.User()
	o.LinkParams = m.LinkParams
	o.CreatedAt = m.CreatedAt
	return o
}
